﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;

namespace _2D
{
    public class Camera2D
    {
        private Vector2 _position;
        public Vector2 position
        {
            get
            {
                return _position;
            }
            set
            {
                _position = value;
            }
        }

        public Camera2D(int x, int y)
        {
            _position = new Vector2(x, y);
        }

        public void moveCamera(float movementX, float movementY)
        {
            _position.X += movementX;
            _position.Y += movementY;
        }

        public bool moveCamera(float movementX, float movementY, int screenWidth, int screenHeight)
        {
            _position.X += movementX;
            _position.Y += movementY;
            if (_position.X > 0 && _position.X < screenWidth && _position.Y > 0 && _position.Y < screenHeight)
            {
                _position.X -= movementX;
                _position.Y -= movementY;

                return true;
            }
            else
                return false;
        }
    }
}
